﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WordBrowse.aspx.cs" Inherits="SkWeb.FAXZ.WordBrowse" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

     <link href="../easyui/themes/icon.css" rel="stylesheet" type="text/css" />
    <link href="../easyui/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <script src="../easyui/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../easyui/jquery.easyui.min.js" type="text/javascript"></script>


    <script type="text/javascript">
        /*
        获取指定的URL参数值
        URL:http://www.blogjava.net/blog?name=bainian
        参数：paramName URL参数
        调用方法:getParam("name")
        返回值:bainian
        */
        //1.
        function getParam(paramName) {
            paramValue = "";
            isFound = false;
            if (this.location.search.indexOf("?") == 0 && this.location.search.indexOf("=") > 1) {
                arrSource = unescape(this.location.search).substring(1, this.location.search.length).split("&");
                i = 0;
                while (i < arrSource.length && !isFound) {
                    if (arrSource[i].indexOf("=") > 0) {
                        if (arrSource[i].split("=")[0].toLowerCase() == paramName.toLowerCase()) {
                            paramValue = arrSource[i].split("=")[1];
                            isFound = true;
                        }
                    }
                    i++;
                }
            }
            return paramValue;
        }

     
        function openDocFile(name) {

            var TANGER_OCX_OBJ = document.getElementById("TANGER_OCX");
            TANGER_OCX_OBJ.OpenFromURL("../DOC/" + name);
            //TANGER_OCX_OBJ.
        }
        function test() {
            var TANGER_OCX_OBJ = document.getElementById("TANGER_OCX");
            TANGER_OCX_OBJ.ActiveDocument.ActiveWindow.DocumentMap = true;
           // TANGER_OCX_OBJ.SaveToURL("../Files/新井--压力1.doc"); //("upload.asp", "EDITFILE", "", "newdoc.doc", 0);
        }

        function SaveFile() {//保存
            var TANGER_OCX_OBJ = document.getElementById("TANGER_OCX");
            if (TANGER_OCX_OBJ === null || TANGER_OCX_OBJ === "undefined") { return false; }
            var fileName = "temp.doc"; // document.getElementById("fileName").value;
            try {
                var tmp_id = escape(getParam("tempalteid"));
                var jing_id = escape(getParam("id"));
                var message = TANGER_OCX_OBJ.SaveToURL("WordBrowse.aspx?op=saveWordDoc&tempalteid=" + tmp_id + "&id=" + jing_id, "editfile", "", fileName, "form1");
            }
            catch (err) {
                alert("err:" + err.number + ":" + err.description);
            } finally { }
        }




        $(function () {

            $("#aSubmitSave").click(function () {
                SaveFile();


            });
        });

    </script>
</head>
<body style="width:100%; height:100%; margin:0px">
    <form id="form1" runat="server">
   <%-- <a id="aSubmitSave" href="javascript:void(0)" class="easyui-linkbutton">保存</a>--%>
  
  <%--  <asp:Button ID="btnSubmit" runat="server" Text="提交" onclick="btnSubmit_Click" />
     <input type="button" value="加密" />--%>
     <div>
    <object id="TANGER_OCX" classid="clsid:C9BC4DFF-4248-4a3c-8A49-63A7D317F404" 
codebase="OfficeControl.cab#version=5,0,2,1" width="98%" height="98%">
<param name="Titlebar" value="false"/>  
<param name="Menubar" value="false"/>  
<param name="Toolbars" value="true"/>  
<param name="Statusbar" value="false"/>  
<param name="BorderStyle" value="0"/>  
<param name="FileNew" value="false"/>  
<param name="FileOpen" value="false"/>  
<param name="FileClose" value="false"/>  
<param name="FileSave" value="true"/>  
<param name="FileSaveAs" value="true"/>  
<param name="FilePrint" value="true"/>  
<param name="ProductCaption" value="东北石油大学"/> 
<param name="ProductKey" value="DAFA0D7CDF60CD7EEBCD8C79AB0E04D3875EB82C"/>
.....
<span style="color:red">该网页需要控件浏览.浏览器无法装载所需要的文档控件.请检查浏览器选项中的安全设置.</span>
</object>

    </div>
     <script type="text/javascript">

         var TANGER_OCX_OBJ = document.getElementById("TANGER_OCX");
         file = getParam("name");
         if (file != null) {
             TANGER_OCX_OBJ.OpenFromURL("../tempDoc/" + escape(file));
             // TANGER_OCX_OBJ.OpenFromURL("../Files/新井--压力.doc");
             TANGER_OCX_OBJ.ActiveDocument.ActiveWindow.DocumentMap = true;
         }
       
    </script>
    </form>
</body>
</html>
